<template>
	<view class="container">
		<navView :isBack="true" backgroundColor="transparent"></navView>
		<image class="background" src="https://hfd.bjlzkj.com/static/user/background1.png" mode="widthFix"></image>
		<!-- 积分显示区域 -->
		<view class="score-container">
			<view class="score">
				<text class="score-label">当前积分</text>
				<text class="score-value">{{ totalScore }}</text>
			</view>
		</view>

		<!-- 合同列表 -->
		<scroll-view class="contract-list" scroll-y>
			<view v-for="(item, index) in contracts" :key="index" class="contract-item">
				<view class="contract-detail">
					<text>{{ item.contract_name }}</text>
					<text class="amount">金额：{{ item.points }}</text>
				</view>
				<text class="score"><text>+{{ item.points }}</text> 积分</text>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				totalScore: 3659, // 当前积分
				contracts: [{
						name: "合同1",
						amount: 36253,
						score: 1500
					}
				],
				userInfo: {}
			};
		},
		onShow() {
			this.userInfo = uni.getStorageSync('userInfo')
			console.log(this.userInfo)
			this.gitList()
		},
		methods: {
			gitList() {
				this.$request('/addons/qingdong/statistics/userScoreRanding', 'GET').then(res => {
					console.log(res)
					this.contracts = res.data.scores
					this.totalScore = res.data.total_points
				})
			}
		}
	};
</script>

<style scoped lang="scss">
	/* 全局样式 */
	.container {
		min-height: 100vh;
		padding: 40rpx;
		box-sizing: border-box;
		position: relative;

		.background {
			width: 100%;
			position: absolute;
			top: 0;
			left: 0;
			z-index: -1;
		}

		/* 积分显示区域 */
		.score-container {
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 40px;

			.score {
				display: flex;
				flex-direction: column;
				align-items: flex-start;
			}

			.score-label {
				font-size: 36rpx;
				color: #ffffff;
			}

			.score-value {
				font-size: 80rpx;
				font-weight: bold;
				color: #ffffff;
			}

		}


		/* 合同列表 */
		.contract-list {
			background: #ffffff;
			border-radius: 20rpx;
			height: 70vh;
			padding: 20rpx;
			box-sizing: border-box;
			box-shadow: 0 8rpx 12rpx rgba(0, 0, 0, 0.1);
		}

		scroll-view ::-webkit-scrollbar {
			display: none;
			width: 0;
			height: 0;
			color: transparent;
		}

		.contract-item {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding: 20rpx 0;
			border-bottom: 1px solid #eeeeee;
		}

		.contract-detail {
			display: flex;
			flex-direction: column;
			font-size: 30rpx;
		}

		.amount {
			font-size: 24rpx;
			color: #666666;
			margin-top: 5rpx;
		}

		.score {
			font-size: 28rpx;

			text {
				color: #0076DE;
				padding-right: 10rpx;
				font-size: 40rpx;
			}
		}
	}
</style>